<template>
  <div class="toolbar-item" @click="insertFillSpace">插入填空符</div>
</template>

<script>
export default {
  props: {},
  inject: ['execCommand'],
  data() {
    return {}
  },
  computed: {},
  watch: {},
  methods: {
    insertFillSpace() {
      const selection = window.getSelection()
      const range = selection && selection.getRangeAt(0)
      if (range) {
        range.insertNode(document.createTextNode('______'))
        range.setStart(range.endContainer, range.endOffset)
        range.setEnd(range.endContainer, range.endOffset)
      }
    },
  },
}
</script>

<style lang="scss" scoped>
@import '@styles/richText/toolbar.scss';
.toolbar-item {
  font-size: 14px;
  padding-bottom: 2px;
}
</style>
